home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 265 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Array Parameters
  5. Date: Wed, 03 Jan 96 20:41:35 GMT
  6. Organization: none
  7. Message-ID: <820701694snz@genesis.demon.co.uk>
  8. References: <wayne.820650643@hawk> <4ce349$4j9@hacgate2.hac.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4ce349$4j9@hacgate2.hac.com>
  15.            collins@thor.tu.hac.com "Ron Collins" writes:
  16.  
  17. >: void test(int num, char ** maps)
  18. >                     ^^^^^^^^^^^^
  19. >
  20. >Change this to
  21. >
  22. >  void test(int num, char*maps[])
  23.  
  24. No need - the rewrite rule for function parameters makes these entirely
  25. equivalent.
  26.  
  27. >While there are circumstances where an array may behave as a pointer,
  28.  
  29. That path leads to confusion. There are no circumstances where an array
  30. may behave as a pointer, however in the context of an expression the
  31. 'value' of an array is a pointer to its first element. It is impossible
  32. to specify an array as a function parameter since, as in the example above,
  33. the compiler 'rewrites' the parameter declaration in terms of a pointer,
  34. i.e. the parameter is truely declared as a pointer and within the function
  35. body behaves just like any other pointer.
  36.  
  37. -- 
  38. -----------------------------------------
  39. Lawrence Kirby | fred@genesis.demon.co.uk
  40. Wilts, England | 70734.126@compuserve.com
  41. -----------------------------------------
  42.